﻿<Application
    x:Class="TestPhone.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone">

    <!--应用程序资源-->
    <Application.Resources>
        <local:LocalizedStrings xmlns:local="clr-namespace:TestPhone" x:Key="LocalizedStrings"/>
        <Style x:Key="SliderStyle1" TargetType="Slider">
            <Setter Property="BorderThickness" Value="0"/>
            <Setter Property="BorderBrush" Value="Transparent"/>
            <Setter Property="Maximum" Value="10"/>
            <Setter Property="Minimum" Value="0"/>
            <Setter Property="Value" Value="0"/>
            <Setter Property="Background" Value="{StaticResource PhoneChromeBrush}"/>
            <Setter Property="Foreground" Value="{StaticResource PhoneAccentBrush}"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Slider">
                        <Grid Background="Transparent">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal"/>
                                    <VisualState x:Name="MouseOver"/>
                                    <VisualState x:Name="Disabled">
                                        <Storyboard>
                                            <DoubleAnimation Duration="0" To="0.1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HorizontalTrack"/>
                                            <DoubleAnimation Duration="0" To="0.1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="VerticalTrack"/>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="HorizontalFill">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="VerticalFill">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Grid x:Name="HorizontalTemplate" Margin="{StaticResource PhoneHorizontalMargin}">
                                <Grid.RowDefinitions>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                </Grid.RowDefinitions>
                                <Rectangle x:Name="HorizontalTrack" Fill="{TemplateBinding Background}" Height="12" IsHitTestVisible="False" Margin="0,6,0,0" Grid.Row="1"/>
                                <Rectangle x:Name="HorizontalFill" Fill="{TemplateBinding Foreground}" Height="12" IsHitTestVisible="False" Margin="0,6,0,0" Grid.Row="1">
                                    <Rectangle.Clip>
                                        <RectangleGeometry Rect="0, 0, 6, 12"/>
                                    </Rectangle.Clip>
                                </Rectangle>
                                <Path x:Name="HorizontalCenterElement" Fill="{StaticResource PhoneForegroundBrush}" Stroke="White"  HorizontalAlignment="Left" Stretch="Fill" Width="50" Height="50">
                                    <Path.Data>
                                        <GeometryGroup>
                                            <PathGeometry>
                                                <PathGeometry.Figures>
                                                    <PathFigure StartPoint="0,0">
                                                        <PathFigure.Segments>
                                                            <ArcSegment Size="30,30" IsLargeArc="True" RotationAngle="270" SweepDirection="Clockwise" Point="30,30"/>
                                                            <LineSegment Point="0,30"/>
                                                            <LineSegment Point="0,0"/>
                                                        </PathFigure.Segments>
                                                    </PathFigure>
                                                </PathGeometry.Figures>
                                            </PathGeometry>
                                            <EllipseGeometry Center="30,0" RadiusX="24" RadiusY="24"/>
                                        </GeometryGroup>
                                    </Path.Data>
                                    <Path.RenderTransform>
                                        <TranslateTransform/>
                                    </Path.RenderTransform>
                                </Path>
                            </Grid>
                            <Grid x:Name="VerticalTemplate" Margin="{StaticResource PhoneVerticalMargin}">
                                <Rectangle x:Name="VerticalTrack" Fill="{TemplateBinding Background}" IsHitTestVisible="False" Margin="18,0,18,0" Width="12"/>
                                <Rectangle x:Name="VerticalFill" Fill="{TemplateBinding Foreground}" IsHitTestVisible="False" Margin="18,0,18,0" Width="12">
                                    <Rectangle.Clip>
                                        <RectangleGeometry Rect="0, 0, 12, 6"/>
                                    </Rectangle.Clip>
                                </Rectangle>
                                <Rectangle x:Name="VerticalCenterElement" Fill="{StaticResource PhoneForegroundBrush}" Height="12" Margin="12,0,12,0" VerticalAlignment="Top" Width="24">
                                    <Rectangle.RenderTransform>
                                        <TranslateTransform/>
                                    </Rectangle.RenderTransform>
                                </Rectangle>
                            </Grid>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Application.Resources>

    <Application.ApplicationLifetimeObjects>
        <!--处理应用程序的生存期事件所需的对象-->
        <shell:PhoneApplicationService
            Launching="Application_Launching" Closing="Application_Closing"
            Activated="Application_Activated" Deactivated="Application_Deactivated"/>
    </Application.ApplicationLifetimeObjects>

</Application>